home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / tclmotif.1 / tclmotif / tm.1.2 / src / tmTclCommands.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-03  |  4.9 KB  |  146 lines

  1. /* 
  2.  * tmTclCommands.c --
  3.  *
  4.  *    This file contains the loader for the commands recognised
  5.  *    by the moat interpreter to give Motif support.
  6.  *
  7.  * Copyright 1993 Jan Newmarch, University of Canberra.
  8.  * Permission to use, copy, modify, and distribute this
  9.  * software and its documentation for any purpose and without
  10.  * fee is hereby granted, provided that the above copyright
  11.  * notice appear in all copies.  The author
  12.  * makes no representations about the suitability of this
  13.  * software for any purpose.  It is provided "as is" without
  14.  * express or implied warranty.
  15.  
  16.  *
  17.  * Copyright 1990-1992 Regents of the University of California.
  18.  * Permission to use, copy, modify, and distribute this
  19.  * software and its documentation for any purpose and without
  20.  * fee is hereby granted, provided that the above copyright
  21.  * notice appear in all copies.  The University of California
  22.  * makes no representations about the suitability of this
  23.  * software for any purpose.  It is provided "as is" without
  24.  * express or implied warranty.
  25.  */
  26.  
  27. #ifndef lint
  28. static char rcsid[] = "$Header$";
  29. #endif
  30. #include "tm.h"
  31. #include "tmFuncs.h"
  32.  
  33. #include <X11/Intrinsic.h>
  34. #include <Xm/ArrowB.h>
  35. #include <Xm/BulletinB.h>
  36. #include <Xm/CascadeB.h>
  37. #include <Xm/Command.h>
  38. #include <Xm/DialogS.h>
  39. #include <Xm/DrawingA.h>
  40. #include <Xm/DrawnB.h>
  41. #include <Xm/FileSB.h>
  42. #include <Xm/Form.h>
  43. #include <Xm/Frame.h>
  44. #include <Xm/Label.h>
  45. #include <Xm/List.h>
  46. #include <Xm/MainW.h>
  47. #include <Xm/MenuShell.h>
  48. #include <Xm/MessageB.h>
  49. #include <Xm/PanedW.h>
  50. #include <Xm/PushB.h>
  51. #include <Xm/RowColumn.h>
  52. #include <Xm/Scale.h>
  53. #include <Xm/ScrollBar.h>
  54. #include <Xm/ScrolledW.h>
  55. #include <Xm/SelectioB.h>
  56. #include <Xm/Separator.h>
  57. #include <Xm/Text.h>
  58. #include <Xm/TextF.h>
  59. #include <Xm/ToggleB.h>
  60.  
  61.  
  62. /*
  63.  * The following structure defines all of the commands supported by
  64.  * Tm, and the C procedures that execute them.
  65.  */
  66.  
  67. typedef struct {
  68.     char *name;            /* Name of command. */
  69.     int (*cmdProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp,
  70.         int argc, char **argv));
  71.                 /* Command procedure. */
  72.     int (*widgetCmdProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp,
  73.         int argc, char **argv));
  74.                 /* Widget Command procedure. */
  75. } TmCmd;
  76.  
  77. static TmCmd commands[] = {
  78.     /*
  79.      * Commands that are part of the intrinsics:
  80.      */
  81.  
  82.     /*
  83.      * Widget-creation commands.
  84.      */
  85.     {xmArrowButton,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  86.     {xmBulletinBoard,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  87.     {xmBulletinBoardDialog, Tm_DialogCmd, Tm_AnyWidgetCmd},
  88.     {xmCascadeButton,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  89.     {xmCommand,        Tm_AnyCmd, Tm_CommandWidgetCmd},
  90.     {xmDialogShell,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  91.     {xmDrawingArea,    Tm_AnyCmd, Tm_DrawnWidgetCmd},
  92.     {xmDrawnButton,    Tm_AnyCmd, Tm_DrawnWidgetCmd},
  93.     {xmErrorDialog,    Tm_DialogCmd, Tm_AnyWidgetCmd},
  94.     {xmFileSelectionBox,Tm_HasChildrenCmd, Tm_AnyWidgetCmd},
  95.     {xmFileSelectionDialog, Tm_DialogCmd, Tm_AnyWidgetCmd},
  96.     {xmForm,        Tm_AnyCmd, Tm_AnyWidgetCmd},
  97.     {xmFormDialog,    Tm_DialogCmd, Tm_AnyWidgetCmd},
  98.     {xmFrame,        Tm_AnyCmd, Tm_AnyWidgetCmd},
  99.     {xmInformationDialog, Tm_DialogCmd, Tm_AnyWidgetCmd},
  100.     {xmLabel,        Tm_AnyCmd, Tm_AnyWidgetCmd},
  101.     {xmList,        Tm_AnyCmd, Tm_ListWidgetCmd},
  102.     {xmMainWindow,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  103.     {xmMenuBar,        Tm_RowColumnCmd, Tm_AnyWidgetCmd},
  104.     {xmMessageBox,    Tm_HasChildrenCmd, Tm_AnyWidgetCmd},
  105.     {xmMessageDialog,    Tm_DialogCmd, Tm_AnyWidgetCmd},
  106.     {xmOptionMenu,    Tm_RowColumnCmd, Tm_AnyWidgetCmd},
  107.     {xmPanedWindow,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  108.     {xmPopupMenu,    Tm_RowColumnCmd, Tm_PopupMenuWidgetCmd},
  109.     {xmPromptDialog,    Tm_DialogCmd, Tm_AnyWidgetCmd},
  110.     {xmPulldownMenu,    Tm_RowColumnCmd, Tm_AnyWidgetCmd},
  111.     {xmPushButton,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  112.     {xmQuestionDialog,    Tm_DialogCmd, Tm_AnyWidgetCmd},
  113.     {xmRowColumn,    Tm_RowColumnCmd, Tm_AnyWidgetCmd},
  114.     {xmScale,        Tm_AnyCmd, Tm_AnyWidgetCmd},
  115.     {xmScrollBar,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  116.     {xmScrolledList,    Tm_ScrolledCmd, Tm_ListWidgetCmd},
  117.     {xmScrolledText,    Tm_ScrolledCmd, Tm_TextWidgetCmd},
  118.     {xmScrolledWindow,    Tm_HasChildrenCmd, Tm_AnyWidgetCmd},
  119.     {xmSelectionBox,    Tm_HasChildrenCmd, Tm_AnyWidgetCmd},
  120.     {xmSelectionDialog,    Tm_DialogCmd, Tm_AnyWidgetCmd},
  121.     {xmSeparator,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  122.     {xmText,        Tm_AnyCmd, Tm_TextWidgetCmd},
  123.     {xmTextField,    Tm_AnyCmd, Tm_TextWidgetCmd},
  124.     {xmToggleButton,    Tm_AnyCmd, Tm_AnyWidgetCmd},
  125.     {xmTopLevelShell,    Tm_AnyCmd, Tm_ShellWidgetCmd},
  126.     {xmWarningDialog,    Tm_DialogCmd, Tm_AnyWidgetCmd},
  127.     {xmWorkingDialog,    Tm_DialogCmd, Tm_AnyWidgetCmd},
  128.     {(char *) NULL,    (int (*)()) NULL, (Tm_WidgetCmdProc) NULL}
  129. };
  130.  
  131. void Tm_LoadWidgetCommands (interp)
  132.     Tcl_Interp *interp;
  133. {
  134.     register TmCmd *cmdPtr;
  135.  
  136.     /*
  137.      * Bind in Tm's commands.
  138.      */
  139.  
  140.     for (cmdPtr = commands; cmdPtr->name != NULL; cmdPtr++) {
  141.     Tcl_CreateCommand(interp, cmdPtr->name, cmdPtr->cmdProc,
  142.         (ClientData) cmdPtr->widgetCmdProc, (void (*)()) NULL);
  143.     }
  144. }
  145.  
  146.